FROM php:7.3-fpm
MAINTAINER "ajiader@163.com"

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
   && sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* &&  cat /etc/apt/sources.list


RUN apt-get update && apt-get install -y \
        bzip2 \
        cron \
	    supervisor \
	    git \
        libbz2-dev \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
	    zip unzip \
	    libxml2-dev \
	    libzip-dev \
	    libzstd-dev \
	    libcurl4-openssl-dev \
	    pkg-config \
	    libssl-dev \
	    curl \ 
	    libmagickwand-dev \
	    imagemagick \ 
	    poppler-utils \
        ghostscript \
	&& curl -sS https://getcomposer.org/installer | php && \
    mv composer.phar /usr/bin/composer && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
	 && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
	 && docker-php-ext-install -j$(nproc) gd \
	 && docker-php-ext-configure zip --with-libzip && docker-php-ext-install zip \
     && docker-php-ext-install bcmath \
     && docker-php-ext-install bz2  \
     && docker-php-ext-install exif  \
     && docker-php-ext-install gettext  \
     && docker-php-ext-install pcntl  \
     && docker-php-ext-install pdo_mysql \
     && docker-php-ext-install shmop  \
     && docker-php-ext-install soap   \
     && docker-php-ext-install sockets \
     && docker-php-ext-install sysvsem  \
     && docker-php-ext-install wddx   \
     && docker-php-ext-install xmlrpc    \
     && docker-php-ext-install opcache  

RUN pecl install igbinary  && docker-php-ext-enable igbinary \
     && pecl install zstd  && docker-php-ext-enable zstd \
     && pecl install --configureoptions 'enable-redis-igbinary="yes" enable-redis-lzf="yes" enable-redis-zstd="yes"' redis \
     &&  docker-php-ext-enable redis \
     && pecl install msgpack && docker-php-ext-enable msgpack \
     && pecl install mongodb && docker-php-ext-enable mongodb \
     && pecl install yar     && docker-php-ext-enable yar \
 	 && pecl install xdebug  && docker-php-ext-enable xdebug \
 	 && pecl install imagick  && docker-php-ext-enable imagick \
 	 && apt-get clean \
     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
     && rm /var/log/lastlog /var/log/faillog

RUN usermod -u 1000 www-data